package cn.gok.swagger_test.controller;

import cn.gok.swagger_test.entity.User;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: LKSV
 * @Description:
 * @Date:Created in 19:19 2021/8/20
 */
@RestController
public class SwaggerTest {

    @ApiOperation("hello测试")
    @RequestMapping("/hello")
    public String hello(){
        return "Hello";
    }

    @ApiOperation(value="创建用户", notes="根据User对象创建用户")
    @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User")
    @PostMapping(value="/addUser")
    public String postUser(@RequestBody User user) {

        return "success";
    }


    @ApiOperation(value="删除用户", notes="根据id删除用户")
    @ApiImplicitParam(name = "user", value = "用户id", required = true, dataType = "int")
    @PostMapping(value="/delUser")
    public String delUser(@RequestBody int id) {

        return "success";
    }

}
